package net.babeuf.form.factory 
{
	import net.babeuf.form.sensors.*;

	/**
	 * ...
	 * @author Damien Pegoraro
	 */
	public class MetaSensorFactory 
	{
		
		static private function getSensorFromType( type : String, o : Object ): AbstractSensor 
		{
			var out : AbstractSensor ; 	
			switch( type ) 
			{
				case "TextFieldColorSensor" :
					out = new TextFieldColorSensor( o.target, uint(o.color)) ; 
				break ;
				case "MovieClipSensor" :
					out = new MovieClipSensor( o.target, o.frame2IsError ? Boolean(o.frame2IsError) : false  ) ; 
				break ;				
				case "BitmapFilterSensor" : 
					throw new Error( "This sensor type is not supported yet in meta mode, but you can still use it in the regular way" ) ; 
				break ;  				
				default : 
					throw new Error( "Unknown sensor type" ) ; 
				break ;
			}
			return out  ;
		}
		
		
		
		
		static public function buildSensorFromObject( o : Object ) : AbstractSensor
		{
			var out : AbstractSensor = getSensorFromType( o.type, o ) ; 
			var type : String = o.type ; 						
			if (  out ) 
			{
					
			}			
			return out ;			
		}
		
	}

}